// 财务中心
import http from '../helper/http.js'
const path = '/api/adm/v1/'

// 津贴列表筛选
export let searchSubsidy = ({ type, role, startTime, endTime, admin, condition, page, num, name }) => {
  return http.post(`${path}subsidy/search`, {
    type, // 0 全部 1 补贴 2 提成 3 扣减
    role, // 0 全部 1 服务商 2代理商 3 省分公司 4 大区分公司
    start_time: startTime,
    end_time: endTime,
    admin,
    condition, // 0 全部 1 流水号 2 名称 3 联系方式
    page,
    num,
    name
  })
}

// 选择角色用户
export let getSubsidyUser = ({ role, page, level, name }) => {
  return http.post(`${path}subsidy/choose`, {
    role,
    page,
    level,
    name
  })
}

// 发放津贴
export let saveSubsidy = ({ type, role, userId, amount, memo }) => {
  return http.post(`${path}subsidy/store`, {
    type,
    role,
    user_id: userId,
    amount,
    memo
  })
}

// 资金流水/api/adm/v1/subsidy/capital
export let subsidyCapital = (params) => {
  return http.post(`${path}subsidy/capital`, params)
}

// 导出资金流水/api/adm/v1/subsidy/merBalanceExport
export let merBalanceExport = (params) => {
  return http.post(`${path}subsidy/merBalanceExport`, params)
}
